<?php
include('wallet_db.html');
//-----------------------------------------------------
$sql['type'] = "SELECT";
$sql['params'] = "country";
$sql['table'] = "resellers";
$sql['where'] = "reseller_id = '$id'";
$sql['options'] = "";
$sql['return'] = "struct";
#$sql['return'] = "query";
//------------------------------------------------------
#exit($res = sql_exec($sql,$dbh81,'assoc'));
if (!$country=sql_exec($sql,$dbh81,'assoc')) {
	exit("Temporary Error!");
}
$country = $country[0]['country'];

//-----------------------------------------------------
$sql['type'] = "SELECT";
$sql['params'] = "*";
$sql['table'] = "rscp_home";
$sql['where'] = "reseller_id = '$id'";
$sql['options'] = "";
$sql['return'] = "struct";
//------------------------------------------------------
$res_a = sql_exec($sql,$dbh81,'assoc');
if (empty($res_a)) {
	$query = "INSERT INTO rscp_home (reseller_id) VALUES('$id')";
	$result = exec_query($query,$dbh81);
	$res_a['reseller_id'] = $id;
	$res_a['store_name'] = 'f';
	$res_a['own_domain'] = 'f';
	$res_a['dns_cluster'] = 'f';
	$res_a['account'] = 'f';
	if ($country == 'US') {
		$res_a['w9_form'] = 'f';
	}
	$res_a['own_prices'] = 'f';
} else {
	$res_a = $res_a[0];
	if ($country != 'US') {
		unset($res_a['w9_form']);
	}
}
#unset($res_a['dns_cluster']);
$count_set = '';
$count_unset = '';
foreach ($res_a as $key => $value) {
	if ($value == 'f') {
		$count_unset++;
	} elseif ($value == 't') {
		$count_set++;
	}
}
?>
<script language='JavaScript'>
<!--
var myWin = '';
function openWin(url, name, properties) {
	if (myWin && myWin.open && !myWin.closed) {
		myWin.close();
	}
	myWin = window.open(url, name, properties);
	return false;
}
//-->
</script>
<div align="left">
<p><b><?=translate('welcome_res_cp');?></b></p>
<br>
<?php
include('home/domain_box.html');
?>
<br>
<?php
include('home/dns_box.html');
?>
<br>
<?php
include('home/plans_box.html');
?>
<br>
<?php
if ($count_set >= 3) {
	include('home/last_sales.html');
	echo "<br />";
	include('home/resellers_steps.html');
} else {
	include('home/resellers_steps.html');
	echo "<br />";
	include('home/last_sales.html');
}
?>
<br />
<?php
include('home/news_box.html');
?>
</div>